[XEND] Re-add vtpm device support in XendConfig
authorAlastair Tse <atse@xensource.com>
Fri, 1 Dec 2006 17:37:42 +0000 (17:37 +0000)
committerAlastair Tse <atse@xensource.com>
Fri, 1 Dec 2006 17:37:42 +0000 (17:37 +0000)
This patch re-adds a recently removed vTPM device handling code.
I am also removing that one code part in the test script that does not
work.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
tools/python/scripts/xapi.py
tools/python/xen/xend/XendConfig.py

index 07d886698b61e5bc9b852f1b820fb37acaced60e..06baeefe4cda5453b46cfb814690e5d092fe83b1 100644 (file)
@@ -446,8 +446,6 @@ def xapi_vtpm_create(*args):
     print "Has driver type '%s'" % driver
     vtpm_rec = execute(server.VTPM.get_record, session, vtpm_uuid)
     print "Has vtpm record '%s'" % vtpm_rec
-    vm = execute(server.VTPM.get_VM, session, vtpm_uuid)
-    print "Has VM '%s'" % vm
 
 
 #
index 5733abf34c9cffd5cc13e2d7f7cc74f074ed4e41..3e4df3183fcb10daea93677fec276c2db5c18b7e 100644 (file)
@@ -945,7 +945,17 @@ class XendConfig(dict):
                 self['devices'][dev_uuid] = (dev_type, dev_info)
                 self['vbd_refs'].append(dev_uuid)                
                 return dev_uuid
-            
+
+            elif dev_type in ('vtpm'):
+                if cfg_xenapi.get('type'):
+                    dev_info['type'] = cfg_xenapi.get('type')
+
+                dev_uuid = cfg_xenapi.get('uuid', uuid.createString())
+                dev_info['uuid'] = dev_uuid
+                self['devices'][dev_uuid] = (dev_type, dev_info)
+                self['vtpm_refs'].append(dev_uuid)
+                return dev_uuid
+
         return ''
 
     def device_update(self, dev_uuid, cfg_sxp):